package com.hearwego;


import java.io.File;

import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;

public class ActivityDetalleFoto extends Activity {
	TextView tx, comentary;
	ImageView im;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_detalle_foto);
		
		Bundle extras = getIntent().getExtras();
		if(extras != null){
			Log.i("comentary", ""+extras.getString("comentary"));
			Log.i("picname", ""+extras.getString("picname"));
			tx = (TextView) findViewById(R.id.title);
			comentary = (TextView) findViewById(R.id.comentary);
			im = (ImageView) findViewById(R.id.photo);
			
			tx.setText(""+extras.getString("picname"));
			comentary.setText(""+extras.getString("comentary"));

			String path = Environment.getExternalStorageDirectory()+"/HearWeGo/"+extras.getString("picname");
            File imgFile = new File(path);
            if(imgFile.exists())
            {
                Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());                  
//                ImageView myImage = (ImageView) findViewById(R.id.imageView1);
                im.setImageBitmap(myBitmap);
            }
            else{                    
//                Toast.makeText(v.getContext(),"no IMAGE IS PRESENT'",Toast.LENGTH_SHORT).show();
        	}
			
//			Log.i("URL IMAGE", ""+Environment.getExternalStorageDirectory().toString()+"/HearWeGo/"+extras.getString("picname"));
//			Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageState().toString()+"/HearWeGo/"+extras.getString("picname"));
//			im.setImageBitmap(bitmap);
			
			

		}
	}
	
	

//	@Override
//	public boolean onCreateOptionsMenu(Menu menu) {
//		// Inflate the menu; this adds items to the action bar if it is present.
//		getMenuInflater().inflate(R.menu.activity_detalle_foto, menu);
//		return true;
//	}

}
